{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3173
  Verdict: Accepted
}
uses SysUtils, Math;
 
const
	firstV:int64=round(1e12);
 
var
	k,kk,ls,cc,ansC,cur,ansV:int64;
	s:string;
	i,j:longint;
	a:array[0..100010] of int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
cc:=0;
ls:=length(s);
while ls>0 do begin
	kk:=pos(' ',s);
	if kk=0 then begin
		k:=strtoint(s);
		s:='';
	end else begin
		k:=strtoint(copy(s,1,kk-1));
		delete(s,1,kk);
	end;
	ls:=length(S);  
	inc(cc);
	a[cc]:=k;
end;
ansV:=0;
ansC:=0;
for i:=1 to cc do begin
	cur:=0;
	for j:=1 to cc do
		if a[i]=a[j] then inc(cur);
	if ansC<cur then begin
		ansC:=cur;
		ansV:=a[i];
	end;
end;
write(ansV);
end.